﻿using System.Windows.Forms;

using Pibby.Core.IO;

namespace Pibby.Controls
{
	public class ListViewFileSizeSubItem : ListViewItem.ListViewSubItem
	{
		private readonly long _size;

		public ListViewFileSizeSubItem(long l)
			: base()
		{
			this._size = l;

			if (l <= 0)
				this.Text = "Unknown";
			else
				this.Text = FileSizeInterpreter.InterpretSize(this.FileSize);
		}

		public long FileSize
		{
			get
			{
				return _size;
			}
		}

		public static int Compare(ListViewFileSizeSubItem first, ListViewFileSizeSubItem second)
		{
			return (int)(first.FileSize - second.FileSize);
		}
	}
}
